package config

import (
	"github.com/ethereum/go-ethereum/ethclient"
	"time"
)

//func NewEthRpcClient() (*ethclient.Client, error) {
//	client, err := ethclient.Dial(global.BlockChainConfig.RpcUrl)
//	if err != nil {
//		return nil, err
//	}
//	return client, nil
//}

func EthRpcClient(rpcUrl string) *ethclient.Client {
	client, err := ethclient.Dial(rpcUrl)
	if err != nil {
		time.Sleep(5 * time.Second)
		EthRpcClient(rpcUrl)
	}
	return client
}
